﻿using System.Collections.Generic;

namespace STT.Parser
{
    public class Create_ConstToString_Table_C : Create_ConstToString_Table
    {
        public override List<string[]> Create_Define_Table()
        {
            List<string[]> list = new List<string[]>();
            for (uint i = 0; i < (Table_Define.Length - 1); i += 2)
            {
                string[] item = new string[] { Table_Define[i], Table_Define[i + 1] };
                list.Add(item);
            }
            return list;
        }

        public override List<string[]> Create_TypeDef_Table()
        {
            List<string[]> list = new List<string[]>();
            for (uint i = 0; i < (Table_TypeDef.Length - 1); i += 2)
            {
                string[] item = new string[] { Table_TypeDef[i], Table_TypeDef[i + 1] };
                list.Add(item);
            }
            return list;
        }

        public override SortedList<long, string> Create_BaseType_Table()
        {
            SortedList<long, string> list = new SortedList<long, string>();
            for (uint i = 0; i < Table_BaseType_Name.Length; i++)
            {
                list.Add((long)Table_BaseType[i], Table_BaseType_Name[i]);
            }
            return list;
        }

        public override SortedList<long, string> Create_CallConv_Table()
        {
            SortedList<long, string> list = new SortedList<long, string>();
            for (uint i = 0; i < Table_CallConv_Name.Length; i++)
            {
                list.Add((long)Table_CallConv[i], Table_CallConv_Name[i]);
            }
            return list;
        }

        private static string[] Table_BaseType_Name = new string[]
        {
            "/*NoType*/",
            "VOID",
            "CHAR",
            "WCHAR",
            "INT",
            "UINT",
            "FLOAT",
            "BCD",
            "BOOL",
            "LONG",
            "ULONG",
            "CURRENCY",
            "DATE",
            "VARIANT",
            "COMPLEX",
            "BIT",
            "BSTR",
            "HRESULT"
        };

        private static string[] Table_CallConv_Name = new string[]
        {
            "NEAR CDECL",
            "FAR CDECL",
            "NEAR PASCAL",
            "FAR PASCAL",
            "NEAR FASTCALL",
            "FAR FASTCALL",
            "SKIPPED",
            "NEAR STDCALL",
            "FAR STDCALL",
            "NEAR SYSCALL",
            "FAR SYSCALL",
            "THISCALL",
            "MIPSCALL",
            "GENERICCALL",
            "ALPHACALL",
            "PPCCALL",
            "SHCALL",
            "ARMCALL",
            "AM33CALL",
            "TRICALL",
            "SH5CALL",
            "M32RCALL",
            "RESERVED_CALL"
        };

        private static string[] Table_Define = new string[]
        {
            "VOID",
            "void",
            "STDCALL",
            "__stdcall",
            "FASTCALL",
            "__fastcall",
            "CDECL",
            "__cdecl",
            "THISCALL",
            "__thiscall",
            "NEAR",
            "",
            "FAR",
            ""
        };

        private static string[] Table_TypeDef = new string[]
        {
            "signed char",
            "INT8",
            "signed char",
            "CHAR",
            "signed short",
            "INT16",
            "signed int",
            "INT32",
            "signed int",
            "BOOL",
            "signed __int64",
            "INT64",
            "signed __int64",
            "LONG64",
            "signed long",
            "LONG32",
            "unsigned char",
            "UINT8",
            "unsigned char",
            "BYTE",
            "unsigned short",
            "UINT16",
            "unsigned short",
            "WCHAR",
            "unsigned int",
            "UINT32",
            "unsigned __int64",
            "UINT64",
            "unsigned __int64",
            "ULONG64",
            "unsigned long",
            "ULONG32",
            "float",
            "FLOAT32",
            "double",
            "FLOAT64",
            "struct {unsigned short W[5];}",
            "FLOAT80",
            "struct { __int64 LowPart;__int64 HighPart;}",
            "FLOAT128",
            "double",
            "DATE",
            "signed long",
            "HRESULT",
            "union { struct {unsigned long Lo; long Hi;}; __int64 int64;}",
            "CURRENCY",
            "wchar_t",
            "OLECHAR"
        };
    }
}